refactor(ui): improve theming system and add cursor support#596
Merged
JasonXuDeveloper merged 2 commits intomasterfrom Jan 29, 2026
Merged
refactor(ui): improve theming system and add cursor support#596JasonXuDeveloper merged 2 commits intomasterfrom
JasonXuDeveloper merged 2 commits intomasterfrom
Conversation
- Simplify Tokens.cs with base Palette class reducing color duplication - Add shared input styling methods to JTheme for consistent form controls - Make JDropdown generic with ForEnum<T>() factory method for enum support - Add JIconButton component for small transparent icon buttons - Add USS-based cursor styles (pointer for clickables, text for inputs) - Fix hover effects using PointerOverEvent/PointerOutEvent for PopupField - Add dynamic toggle thumb colors using Primary/Secondary tokens - Update BootstrapEditorUI and PanelUI to use generic components - Remove unused JFormSection.cs and PopupFieldStyleHelper.cs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
Unity Test Results✅ EditMode: All tests passed Unity Version: 2022.3.55f1 ✅ All tests passed! The PR is ready for review. View workflow run |
There was a problem hiding this comment.
Pull request overview
This PR refactors the JEngine UI theming system to improve code organization, type safety, and user experience. The changes consolidate duplicate styling code, introduce generic components for better type safety, and add USS-based cursor support for improved UX.
Changes:
- Refactored
Tokens.cswith a basePaletteclass to eliminate color duplication and improve maintainability - Added shared input styling methods to
JTheme.csfor consistent form control appearance across all components - Made
JDropdowngeneric with aForEnum<T>()factory method, enabling type-safe enum handling without string conversions - Added
JIconButtoncomponent for small transparent icon buttons used in toolbars - Implemented USS-based cursor styles (pointer for clickables, text for inputs) with proper stylesheet integration
- Updated hover effects to use
PointerOverEvent/PointerOutEventfor better compatibility with PopupField internals - Added dynamic toggle thumb colors using Primary/Secondary tokens for better visual contrast
- Updated
BootstrapEditorUIandPanelUIto use new generic components, eliminatingEnumHelpersdependencies - Removed unused
JFormSection.csandPopupFieldStyleHelper.csfiles
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Tokens.cs |
Refactored with Palette base class to centralize color definitions and reduce duplication |
JTheme.cs |
Added shared input styling methods (ApplyInputContainerStyle, ApplyInputElementStyle, etc.) and cursor utilities |
components.uss |
Added USS cursor classes and JDropdown styles with hover states |
tokens.uss |
Added --j-bg-input CSS variable for input backgrounds |
JDropdown.cs |
Made generic with ForEnum<T>() factory, replaced polling-based styling with direct application |
JIconButton.cs |
New component for small icon buttons with transparent backgrounds |
JTextField.cs |
Refactored to use shared JTheme styling methods |
JObjectField.cs |
Made generic, removed non-generic version, uses shared styling methods |
JToggle.cs |
Added dynamic thumb colors based on state for better visual feedback |
JButton.cs, JToggleButton.cs |
Added pointer cursor support and token usage consistency |
JBreadcrumb.cs |
Changed hover color to use BgSurface instead of BgHover |
JLogView.cs |
Changed background to BgInput for consistent control styling |
JFormField.cs |
Changed font size to use Tokens.FontSize.Sm token |
PanelUI.cs |
Updated to use generic JDropdown<T> and JObjectField<T>, replaced custom icon button code with JIconButton |
BootstrapEditorUI.cs |
Updated to use generic components, eliminated EnumHelpers usage |
PopupFieldStyleHelper.cs |
Removed - functionality replaced by USS styles and JTheme methods |
JFormSection.cs |
Removed - unused component |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JDropdown.cs
Outdated
Show resolved
Hide resolved
Address Copilot review feedback - always use formatter constructor instead of conditional branches. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tokens.cswith basePaletteclass reducing color duplicationJThemefor consistent form controlsJDropdowngeneric withForEnum<T>()factory method for enum supportJIconButtoncomponent for small transparent icon buttonsPointerOverEvent/PointerOutEventforPopupFieldBootstrapEditorUIandPanelUIto use generic componentsJFormSection.csandPopupFieldStyleHelper.csTest plan
🤖 Generated with Claude Code